package com.fa4j.system.account.controller;

import com.fa4j.system.account.api.AccountLogClient;
import com.fa4j.system.account.convert.AccountLogConverter;
import com.fa4j.system.account.dto.AccountLogCreateRequest;
import com.fa4j.system.account.model.AccountLogCreateCmd;
import com.fa4j.system.account.service.AccountLogService;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Hidden
@RestController
@RequestMapping("system/account/log")
@RequiredArgsConstructor
public class AccountLogResource implements AccountLogClient {

    private final AccountLogService accountLogService;
    private final AccountLogConverter accountLogConverter;

    @Override
    @Operation(summary = "保存", description = "保存账户日志")
    public void saveLog(AccountLogCreateRequest request) {
        AccountLogCreateCmd cmd = accountLogConverter.toCreateCmd(request);
        accountLogService.create(cmd);
    }
}
